<?php
//自动加载
spl_autoload_register(function ($class) {
    $basePath = dirname(dirname(__FILE__));
    $nameSpaceSplit = explode('\\', $class);
    array_shift($nameSpaceSplit);
    $classPath = implode('/', array_merge([$basePath], $nameSpaceSplit)) . '.php';
    include_once $classPath;
});

$payload = new \Push\Payloads\TitleBodyPayload();
$payload->setTitle('test');
$payload->setBody('hello Wang!');
$payload->setBadge(1);
$payload->setSound('default');
$payload->setExtraMessage(['today' => 'Sunday']);

$service = new \Push\Service([
    'serviceUrl' => 'ssl://gateway.push.apple.com:2195',
    'certificate' => '/your/certificate/path/ck.pem',
    'passPhrase' => 'your password',
]);
$service->setExpiry(0);
$service->setPayload($payload);

$request->setTokens([
    '17871d9fe713c75aa2edvg62c0dcdeb57591069ef7ebcca151760bc36c820872',
    '27871d9fe713c75aa2edvg62c0dcdeb57591069ef7ebcca151760bc36c820872'
]);
$service->addToken('37871d9fe713c75aa2edvg62c0dcdeb57591069ef7ebcca151760bc36c820872');
$service->push();

$report = $service->getReports();
var_dump($report);
